Skip to content

refactor: Update workspace new to produce logs describing when a workspace has been created but failed to populate its state - #39192

Open
SarahFrench wants to merge 2 commits into
mainfrom
refactor-workspace-new-log-failure-to-populate-state
Open

SarahFrench wants to merge 2 commits into
mainfrom
refactor-workspace-new-log-failure-to-populate-state

Conversation

@SarahFrench

@SarahFrench SarahFrench commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

This PR is intended to prevent a scenario where the workspace new command logs a success message after creating an empty workspace but then logs additional errors that show the -state flag wasn't able to be used successfully.

Instead, the success message should only be logged in scenarios where we return 0.

If a workspace is created but the -state flag cannot be used successfully then the command has had side-effects when failing. These changes let the user know that their intended outcome wasn't reached and gives some input on how to proceed.

Target Release

1.18.x

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

CHANGELOG entry

  • This change is user-facing and I added a changelog entry.
  • This change is not user-facing.

@SarahFrench SarahFrench added the no-changelog-needed Add this to your PR if the change does not require a changelog entry label Sep 11, 2026
@SarahFrench
SarahFrench changed the base branch from main to refactor-workspace-new-use-views September 11, 2026 14:10
@SarahFrench
SarahFrench force-pushed the refactor-workspace-new-use-views branch from aa3cc9d to 24901e9 Compare September 11, 2026 14:14
@SarahFrench
SarahFrench force-pushed the refactor-workspace-new-log-failure-to-populate-state branch from 35b9f34 to aad4b94 Compare September 11, 2026 14:14
@SarahFrench
SarahFrench force-pushed the refactor-workspace-new-use-views branch 3 times, most recently from dd77deb to cf77dff Compare October 1, 2026 16:30
@SarahFrench
SarahFrench force-pushed the refactor-workspace-new-log-failure-to-populate-state branch from aad4b94 to 953ad2b Compare October 1, 2026 16:40
@SarahFrench

Copy link
Copy Markdown
Member Author

Rebased as the base branch has changed

Base automatically changed from refactor-workspace-new-use-views to main October 2, 2026 10:42
@SarahFrench
SarahFrench force-pushed the refactor-workspace-new-log-failure-to-populate-state branch from 953ad2b to 1bd9a2d Compare October 2, 2026 14:27
return 1
}

view.LogWorkspaceCreationSuccess(workspace, diags)

@SarahFrench SarahFrench Oct 2, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This output doesn't explicitly communicate 'we created a workspace and we used the -state flag as you expected', but I think that's fine. The more important thing is only reporting success alongside returning 0.

@SarahFrench
SarahFrench marked this pull request as ready for review October 2, 2026 14:35
@SarahFrench
SarahFrench requested a review from a team as a code owner October 2, 2026 14:35

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog-needed Add this to your PR if the change does not require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant